class Pen {
	constructor() {
		document.onmousedown = this.down.bind(this);
	}
	down() {
		document.onmousemove = this.move.bind(this);
		document.onmouseup = this.up.bind(this);
	}
	move(e) {
		var e = e || event;
		var div = document.getElementById("box");
		div.style.cssText = "left:" + e.clientX + "px; top:" + e.clientY + "px;";
		div.style.background = "#286090";
	}
	up() {
		document.onmousemove = null;
		document.onmouseup = null;
	}
}			
window.onload = function () {
	new Pen();
}